<template>
  <j-modal
    :title="title"
    :width="width"
    :visible="visible"
    switchFullscreen
    @ok="handleOk"
    :okButtonProps="{ class:{'jee-hidden': disableSubmit} }"
    @cancel="handleCancel"
    cancelText="关闭">

  </j-modal>
</template>

<script>
 import { httpAction, getAction } from '@/api/manage'
 import {codeInfoList,codeInfoByTypeAndParent} from '@/api/codeInfo'
  export default {
    name: 'StdSamplePermissionModal',
    components: {
      StdSamplePermissionForm
    },
    data () {
      return {
        title:'',
        width:800,
        visible: false,
        disableSubmit: false,
        scopeId:'',
        treeData:[],
        permissionList:[],
      }
    },
    mounted(){
      this.initDictConfig()
    },
    methods: {
         initDictConfig(){
         const list = ['标准样数据权限']
        list.forEach((item, index)=>{
          codeInfoList({type:item,pageSize:-1,isdel: 0,column:"code",order:"Asc"}).then((res) => {
            if (res.code == 200) {
              this.treeData = res.result.records
            
            } else {
              this.$message.warning('操作异常:' + res.message)
            }
          })
        })  
        },
      add () {
        this.visible=true
        
        this.$nextTick(()=>{
          getAction('/stdSampleScope/permissionList',{scopeId:this.scopeId}).then(res=>{
             if (res.code == 200) {
              this.permissionList = res.result
            
            } else {
              this.$message.warning('操作异常:' + res.message)
            }
        })
        })
      },

      close () {
        this.$emit('close');
        this.visible = false;
      },
      handleOk () {
        this.submitCallback();
      },
      submitCallback(){
        this.$emit('ok');
        this.visible = false;
      },
      handleCancel () {
        this.close()
      }
    }
  }
</script>